package cn.wolfcode.edu.service.impl;

import cn.wolfcode.edu.domain.BigCustomer;
import cn.wolfcode.edu.mapper.BigCustomerMapper;
import cn.wolfcode.edu.query.QueryObject;
import cn.wolfcode.edu.service.IBigCustomerService;
import cn.wolfcode.edu.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by NEUZJ on 2018/7/8.
 */
@Service
public class BigCustomerServiceImpl implements IBigCustomerService{
    @Autowired
    private BigCustomerMapper bigCustomerMapper;
    @Override
    public void save(BigCustomer bigcustomer) {
        System.out.print(bigcustomer);
        bigCustomerMapper.insert(bigcustomer);
    }

    @Override
    public PageResult query(QueryObject qo) {
        int  total=bigCustomerMapper.queryForCount(qo);
        if(total==0){
            return new PageResult();
        }
        List list=bigCustomerMapper.queryForList(qo);
        return new PageResult(total,list);
    }

    @Override
    public void update(BigCustomer bigcustomer) {
        System.out.print(bigcustomer);
        bigCustomerMapper.updateByPrimaryKey(bigcustomer);

    }

    @Override
    public void delete(Long id) {
        bigCustomerMapper.fireBigCustomerById(id);
    }

    @Override
    public void sign(Long id, Integer flag) {
        bigCustomerMapper.sign(id,flag);
    }

    //陈遵汉 专有
    public List<BigCustomer> listAll() {
        return bigCustomerMapper.selectAll();
    }
    //陈遵汉 专有
}
